//
//  CPAudioPlayerViewForCell.h
//  AFNetworking
//
//  Created by CollegePre on 2018/4/9.
//

#import <UIKit/UIKit.h>
#import "CPAudioTools.h"
#import "CPAudioPlayer.h"

// 监听关闭按钮
typedef void(^CPAudioPlayerCloseBlock)();

// 播放完成结束回调Block
typedef void(^CPAudioPlayerComplitionBlock)();

// 监听进度播放
typedef void(^CPAudioPlayerProgressBlock)(double progress);

// 监听进度播放
typedef void(^CPAudioPlayerDragProgressBlock)(double progress,BOOL playState);

// 监听开始暂停
typedef void(^CPAudioPlayerPlayBlock)(NSTimeInterval currentTime,BOOL isStart);

// 将要播放
typedef void(^CPAudioPlayerWillPlayBlock)();

@interface CPAudioPlayerViewForCell : UIView

+ (instancetype)audioPlayerView;
- (instancetype)audioPlayerViewWithSuperView:(UIView *)superView;

- (void)startPlayWithAudioPath:(NSString *)path complition:(CPAudioPlayerComplitionBlock)complition;

- (void)puasePlayAuido;

- (void)continuePlayAudio;

- (void)stopPlayAudio;

@property (nonatomic, strong) UIWebView *webView;

@property (nonatomic, copy) CPAudioPlayerCloseBlock closeBlock;

@property (nonatomic, copy) CPAudioPlayerProgressBlock progressBlock;

@property (nonatomic, copy) CPAudioPlayerPlayBlock playBlock;

@property (nonatomic, copy) CPAudioPlayerWillPlayBlock willPlayBlock;

@property (nonatomic, copy) CPAudioPlayerComplitionBlock complitionBlock;

@property (copy,nonatomic) CPAudioPlayerDragProgressBlock dragProgressBlock;

@property (nonatomic, assign,readonly) double  audioPlayProgress;

@property (nonatomic, strong) CPAudioPlayer *audioPlayer;

// 手动点击暂停按钮（默认为NO）
@property (nonatomic, assign) BOOL manualPausePlaying;

//播放按钮
@property (weak, nonatomic) IBOutlet UIButton *playBtn;

// 播放进度条控制
@property (weak, nonatomic) IBOutlet UISlider *progressSlider;

// 播放音频的路径
@property (copy,nonatomic) NSString *audioPath;

- (void)setAudioPlayProgress:(double)progress audioPlayState:(BOOL)isPlay;

@end
